Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make handling of EMME matrices less error-prone and more flexible #525

Merged
merged 13 commits into from
Sep 4, 2023

Conversation

zptro
Copy link
Collaborator

@zptro zptro commented Jun 20, 2023

With this PR, EMME matrix ids are no longer set manually. Instead, they are created with an algorithm according to the same principles as before:

  • The id number space is one hundred for each time period (if matrices for each time period is to be saved in EMME).
  • The id number space is ten for each matrix type (demand, time, dist, cost, gen_cost), but the algorithm checks whether the number of assignment classes is more than ten; in that case it assigns more than ten numbers per matrix type.
  • As previously, the extra transit impedance matrices (that are not used in demand calculation or cba), are stored in a separate number space with 10 numbers for each transit assignment class. The calculation of these is no longer hard-coded in TransitSpecification; instead the appropriate matrix names are taken from the parameter file.

The matrix id numbers are now internally stored in a more simple dict structure (which directly corresponds to how the matrices are handled in the scripts), which is created in a separate method:

dict
key : str
Assignment class (car_work/transit_leisure/...)
value : dict
key : str
Matrix type (demand/time/cost/dist/...)
value : str
EMME matrix id

@zptro
Copy link
Collaborator Author

zptro commented Jun 29, 2023

@hsl-petrhaj @johpiip are you able to look at this?

@hsl-petrhaj
Copy link
Contributor

I did not have time for testing it yet, I should be able to check it this week.

hsl-petrhaj
hsl-petrhaj previously approved these changes Jun 29, 2023
Copy link
Contributor

@hsl-petrhaj hsl-petrhaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing looks fine with mock run, so I approve it for now.

@hsl-petrhaj
Copy link
Contributor

Now testing still with Emme run.

@hsl-petrhaj hsl-petrhaj self-requested a review June 29, 2023 07:49
@hsl-petrhaj
Copy link
Contributor

hsl-petrhaj commented Jun 29, 2023

@zptro The validate script (helmet_validate_inputfiles.py) now does not work, as the parameter names have changed. Please also check the tests.

[UI-event] Initializing run of scenarios: kth_testi2
[INFO 10:47] Checking base inputdata...
[INFO 10:47] Checking base zonedata & scenario-based input data...
[INFO 10:47] Checking input data for scenario #0 ...
[EXCEPTION] Traceback (most recent call last):
[EXCEPTION]   File "...\Scripts\helmet_validate_inputfiles.py", line 252, in <module>
[EXCEPTION]     main(args)
[EXCEPTION]   File "...\Scripts\helmet_validate_inputfiles.py", line 135, in main
[EXCEPTION]     nr_vehicle_classes = len(param.emme_demand_mtx) + 1
[EXCEPTION] AttributeError: module 'parameters.assignment' has no attribute 'emme_demand_mtx'
[ERROR] {"message": "Checking base inputdata...", "level": "INFO"}
{"message": "Checking base zonedata & scenario-based input data...", "level": "INFO"}
{"message": "Checking input data for scenario #0 ...", "level": "INFO"}
Traceback (most recent call last):
  File "...\Scripts\helmet_validate_inputfiles.py", line 252, in <module>
    main(args)
  File "...\Scripts\helmet_validate_inputfiles.py", line 135, in main
    nr_vehicle_classes = len(param.emme_demand_mtx) + 1
AttributeError: module 'parameters.assignment' has no attribute 'emme_demand_mtx'

@hsl-petrhaj
Copy link
Contributor

For some reason I had to increase the size of the Emmebank for extra attributes, I guess we have some new ones now? I will then need to update helmet-docs as well.

hsl-petrhaj
hsl-petrhaj previously approved these changes Jun 29, 2023
Copy link
Contributor

@hsl-petrhaj hsl-petrhaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine now. Not sure why I got the "not enough space" error in Emme, but perhaps this could be coming from somewhere else. Anyway it was easy to get this version to run.

@zptro
Copy link
Collaborator Author

zptro commented Jun 29, 2023

For some reason I had to increase the size of the Emmebank for extra attributes, I guess we have some new ones now? I will then need to update helmet-docs as well.

That is not very good. I found the problem and fixed. We do not need an extra attribute for walking, as we do not assign walk trips.

@hsl-petrhaj
Copy link
Contributor

I am getting some division by zero errors when running with Emme in the second iteration. Trying to figure out if it is related to those changes.

@hsl-petrhaj
Copy link
Contributor

hsl-petrhaj commented Jun 29, 2023

@zptro
I just verified that the error only appears in this pull request. Here is the error:


[INFO 16:50] Starting iteration 1
[INFO 16:50] Demand calculation started...
[EXCEPTION] ...\Scripts\models\logit.py:401: RuntimeWarning: divide by zero encountered in log
[EXCEPTION]   logsum = pandas.Series(numpy.log(expsum), self.purpose.zone_numbers)
[EXCEPTION] ...\Scripts\models\logit.py:418: RuntimeWarning: invalid value encountered in true_divide
[EXCEPTION]   / self.dest_expsums[mode]["logsum"])
[EXCEPTION] ...\Scripts\datatypes\purpose.py:258: RuntimeWarning: invalid value encountered in greater
[EXCEPTION]   dests = generation > secondary_destination_threshold
[INFO 16:50] Demand calculation completed
[WARN] (2, 12) car_leisure matrix not matching 28 demand shares. Resorted to backup demand shares.
[WARN] (2, 12) car_leisure matrix not matching 28 demand shares. Resorted to backup demand shares.
[EXCEPTION] ...\modelsystem.py:289: RuntimeWarning: invalid value encountered in double_scalars
[EXCEPTION]   mode_shares[mode] = tour_sum[mode].sum() / sum_all.sum()
[INFO 16:50] Assigning period aht
[ERROR] NAs in demand matrix car_leisure would cause infinite loop in Emme assignment.
[ERROR] Exception at iteration 1
[EXCEPTION] Traceback (most recent call last):
[EXCEPTION]   File "...\Scripts\helmet.py", line 105, in main
[EXCEPTION]     else model.run_iteration(impedance, i))
[EXCEPTION]   File "...\Scripts\modelsystem.py", line 310, in run_iteration
[EXCEPTION]     impedance[tp] = ap.assign(self.dtm.demand[tp], iteration)
[EXCEPTION]   File "...\Scripts\assignment\assignment_period.py", line 107, in assign
[EXCEPTION]     self._set_emmebank_matrices(matrices, iteration=="last")
[EXCEPTION]   File "...\Scripts\assignment\assignment_period.py", line 417, in _set_emmebank_matrices
[EXCEPTION]     self._set_matrix(mtx, matrices[mtx])
[EXCEPTION]   File "...\Scripts\assignment\assignment_period.py", line 424, in _set_matrix
[EXCEPTION]     raise ValueError(msg)
[EXCEPTION] ValueError: NAs in demand matrix car_leisure would cause infinite loop in Emme assignment.
[EXCEPTION] {"message": "Fatal error occured, simulation aborted.", "level": "ERROR", "status": {"name": "test100", "state": "running", "current": 1, "completed": 0, "failed": 1, "total": 15, "log": "E:\\Results\\test0\\test100\\test100.log", "converged": 0, "results": [{"car": NaN, "transit": NaN, "bike": NaN, "walk": NaN}]}}
[WARN] Model has not converged
[INFO 16:50] Removed strategy files in D:\helmet_41\Projektit\testiverkko\database
[EXCEPTION] {"message": "Simulation ended.", "level": "INFO", "status": {"name": "test100", "state": "running", "current": 1, "completed": 0, "failed": 1, "total": 15, "log": "E:\\Results\\test0\\test100\\test100.log", "converged": 0, "results": [{"car": NaN, "transit": NaN, "bike": NaN, "walk": NaN}]}}
[UI-event] Scenario "test100" finished

Could there be some issue with the demand matrix?

Copy link
Contributor

@hsl-petrhaj hsl-petrhaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs some further checks.

@zptro
Copy link
Collaborator Author

zptro commented Aug 1, 2023

@zptro I just verified that the error only appears in this pull request. Here is the error:


[INFO 16:50] Starting iteration 1
[INFO 16:50] Demand calculation started...
[EXCEPTION] ...\Scripts\models\logit.py:401: RuntimeWarning: divide by zero encountered in log
[EXCEPTION]   logsum = pandas.Series(numpy.log(expsum), self.purpose.zone_numbers)
[EXCEPTION] ...\Scripts\models\logit.py:418: RuntimeWarning: invalid value encountered in true_divide
[EXCEPTION]   / self.dest_expsums[mode]["logsum"])
[EXCEPTION] ...\Scripts\datatypes\purpose.py:258: RuntimeWarning: invalid value encountered in greater
[EXCEPTION]   dests = generation > secondary_destination_threshold
[INFO 16:50] Demand calculation completed
[WARN] (2, 12) car_leisure matrix not matching 28 demand shares. Resorted to backup demand shares.
[WARN] (2, 12) car_leisure matrix not matching 28 demand shares. Resorted to backup demand shares.
[EXCEPTION] ...\modelsystem.py:289: RuntimeWarning: invalid value encountered in double_scalars
[EXCEPTION]   mode_shares[mode] = tour_sum[mode].sum() / sum_all.sum()
[INFO 16:50] Assigning period aht
[ERROR] NAs in demand matrix car_leisure would cause infinite loop in Emme assignment.
[ERROR] Exception at iteration 1
[EXCEPTION] Traceback (most recent call last):
[EXCEPTION]   File "...\Scripts\helmet.py", line 105, in main
[EXCEPTION]     else model.run_iteration(impedance, i))
[EXCEPTION]   File "...\Scripts\modelsystem.py", line 310, in run_iteration
[EXCEPTION]     impedance[tp] = ap.assign(self.dtm.demand[tp], iteration)
[EXCEPTION]   File "...\Scripts\assignment\assignment_period.py", line 107, in assign
[EXCEPTION]     self._set_emmebank_matrices(matrices, iteration=="last")
[EXCEPTION]   File "...\Scripts\assignment\assignment_period.py", line 417, in _set_emmebank_matrices
[EXCEPTION]     self._set_matrix(mtx, matrices[mtx])
[EXCEPTION]   File "...\Scripts\assignment\assignment_period.py", line 424, in _set_matrix
[EXCEPTION]     raise ValueError(msg)
[EXCEPTION] ValueError: NAs in demand matrix car_leisure would cause infinite loop in Emme assignment.
[EXCEPTION] {"message": "Fatal error occured, simulation aborted.", "level": "ERROR", "status": {"name": "test100", "state": "running", "current": 1, "completed": 0, "failed": 1, "total": 15, "log": "E:\\Results\\test0\\test100\\test100.log", "converged": 0, "results": [{"car": NaN, "transit": NaN, "bike": NaN, "walk": NaN}]}}
[WARN] Model has not converged
[INFO 16:50] Removed strategy files in D:\helmet_41\Projektit\testiverkko\database
[EXCEPTION] {"message": "Simulation ended.", "level": "INFO", "status": {"name": "test100", "state": "running", "current": 1, "completed": 0, "failed": 1, "total": 15, "log": "E:\\Results\\test0\\test100\\test100.log", "converged": 0, "results": [{"car": NaN, "transit": NaN, "bike": NaN, "walk": NaN}]}}
[UI-event] Scenario "test100" finished

Could there be some issue with the demand matrix?

The problem was that transit time matrices were 9999, because assignment did not write anything to them, because I had accidentally dropped that line. Now this is fixed.

@zptro
Copy link
Collaborator Author

zptro commented Aug 1, 2023

@johpiip could you review this now?

Copy link
Contributor

@johpiip johpiip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi and thank you for your PR! I am sad to see the Emme matrix cheatsheet go but I understand the reasoning behind. 😊

I tried running this branch with the samll test network. I encountered an type error, maybe you can check it?

[UI-event] Initializing run of scenarios: testi_emme-matrices
[INFO 10:21] Checking base inputdata...
[INFO 10:21] Checking base zonedata & scenario-based input data...
[INFO 10:21] Checking input data for scenario #0 ...
[INFO 10:21] Successfully validated all input files
[UI-event] Running scenario "testi_emme-matrices"
[INFO 10:21] Initializing Emme...
[INFO 10:21] Starting Emme...
[INFO 10:21] Emme started
[INFO 10:21] Initializing matrices and models...
[INFO 10:21] Starting simulation with 15 iterations...
[INFO 10:21] Calculates road charges for time period aht...
[INFO 10:21] Calculates road charges for time period pt...
[INFO 10:21] Calculates road charges for time period iht...
[INFO 10:21] Pedestrian assignment started...
[INFO 10:21] Pedestrian assignment performed for scenario 51
[INFO 10:21] Sets bike functions for scenario 51
[INFO 10:21] Bike assignment started...
[INFO 10:21] Bike assignment performed for scenario 51
[INFO 10:21] Sets car and transit functions for scenario 51
[INFO 10:21] Car assignment started...
[INFO 10:21] Car assignment performed for scenario 51
[INFO 10:21] Stopping criteria: RELATIVE_GAP, iteration 2 / 200
[INFO 10:21] Calculates cumulative travel times for scenario 51
[INFO 10:21] Transit assignment started...
[INFO 10:21] Transit assignment performed for scenario 51
[EXCEPTION] Traceback (most recent call last):
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\helmet.py", line 269, in <module>
[EXCEPTION]     main(args)
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\helmet.py", line 96, in main
[EXCEPTION]     args.use_fixed_transit_cost, iterations==0)
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\modelsystem.py", line 179, in assign_base_demand
[EXCEPTION]     self.ass_model.init_assign(base_demand)
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\assignment\emme_assignment.py", line 104, in init_assign
[EXCEPTION]     self._copy_matrix("time", "bike", ap0, ap)
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\assignment\emme_assignment.py", line 277, in _copy_matrix
[EXCEPTION]     "{} {}".format(to_mtx["description"], ass_period_2.name))
[EXCEPTION] TypeError: string indices must be integers
[ERROR] [...] TypeError: string indices must be integers
[UI-event] Scenario "testi_emme-matrices" finished

My setting were following:

2023-08-17 10:21:41 [DEBUG] helmet_version=v4.1.3
2023-08-17 10:21:41 [DEBUG] sys.version_info=3
2023-08-17 10:21:41 [DEBUG] sys.path=['C:\\Users\\PiippJo\\Downloads\\helmet-model-system-refactor-emme_matrices\\Scripts', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\python37.zip', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\DLLs', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37', 'C:\\Users\\PiippJo\\AppData\\Roaming\\Python\\Python37\\site-packages', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib\\site-packages', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib\\site-packages\\win32', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib\\site-packages\\win32\\lib', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib\\site-packages\\Pythonwin']
2023-08-17 10:21:41 [DEBUG] log_level=DEBUG
2023-08-17 10:21:41 [DEBUG] log_format=JSON
2023-08-17 10:21:41 [DEBUG] end_assignment_only=False
2023-08-17 10:21:41 [DEBUG] is_agent_model=False
2023-08-17 10:21:41 [DEBUG] do_not_use_emme=False
2023-08-17 10:21:41 [DEBUG] separate_emme_scenarios=False
2023-08-17 10:21:41 [DEBUG] save_matrices=True
2023-08-17 10:21:41 [DEBUG] del_strat_files=True
2023-08-17 10:21:41 [DEBUG] scenario_name=testi_emme-matrices
2023-08-17 10:21:41 [DEBUG] results_path=E:\Results\Jopi_testi
2023-08-17 10:21:41 [DEBUG] emme_path=D:\helmet_41\Projektit\pienitestiprojekti\pienitestiprojekti.emp
2023-08-17 10:21:41 [DEBUG] first_scenario_id=51
2023-08-17 10:21:41 [DEBUG] first_matrix_id=400
2023-08-17 10:21:41 [DEBUG] baseline_data_path=C:\Users\PiippJo\Downloads\helmet-model-system-olusanya\Scripts\tests\test_data\Base_input_data
2023-08-17 10:21:41 [DEBUG] forecast_data_path=C:\Users\PiippJo\Downloads\helmet-model-system-olusanya\Scripts\tests\test_data\Scenario_input_data\2030_test
2023-08-17 10:21:41 [DEBUG] iterations=15
2023-08-17 10:21:41 [DEBUG] max_gap=1.0
2023-08-17 10:21:41 [DEBUG] rel_gap=0.01
2023-08-17 10:21:41 [DEBUG] use_fixed_transit_cost=False

@zptro
Copy link
Collaborator Author

zptro commented Aug 17, 2023

Hi and thank you for your PR! I am sad to see the Emme matrix cheatsheet go but I understand the reasoning behind. 😊

I tried running this branch with the samll test network. I encountered an type error, maybe you can check it?

[UI-event] Initializing run of scenarios: testi_emme-matrices
[INFO 10:21] Checking base inputdata...
[INFO 10:21] Checking base zonedata & scenario-based input data...
[INFO 10:21] Checking input data for scenario #0 ...
[INFO 10:21] Successfully validated all input files
[UI-event] Running scenario "testi_emme-matrices"
[INFO 10:21] Initializing Emme...
[INFO 10:21] Starting Emme...
[INFO 10:21] Emme started
[INFO 10:21] Initializing matrices and models...
[INFO 10:21] Starting simulation with 15 iterations...
[INFO 10:21] Calculates road charges for time period aht...
[INFO 10:21] Calculates road charges for time period pt...
[INFO 10:21] Calculates road charges for time period iht...
[INFO 10:21] Pedestrian assignment started...
[INFO 10:21] Pedestrian assignment performed for scenario 51
[INFO 10:21] Sets bike functions for scenario 51
[INFO 10:21] Bike assignment started...
[INFO 10:21] Bike assignment performed for scenario 51
[INFO 10:21] Sets car and transit functions for scenario 51
[INFO 10:21] Car assignment started...
[INFO 10:21] Car assignment performed for scenario 51
[INFO 10:21] Stopping criteria: RELATIVE_GAP, iteration 2 / 200
[INFO 10:21] Calculates cumulative travel times for scenario 51
[INFO 10:21] Transit assignment started...
[INFO 10:21] Transit assignment performed for scenario 51
[EXCEPTION] Traceback (most recent call last):
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\helmet.py", line 269, in <module>
[EXCEPTION]     main(args)
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\helmet.py", line 96, in main
[EXCEPTION]     args.use_fixed_transit_cost, iterations==0)
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\modelsystem.py", line 179, in assign_base_demand
[EXCEPTION]     self.ass_model.init_assign(base_demand)
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\assignment\emme_assignment.py", line 104, in init_assign
[EXCEPTION]     self._copy_matrix("time", "bike", ap0, ap)
[EXCEPTION]   File "C:\Users\PiippJo\Downloads\helmet-model-system-refactor-emme_matrices\Scripts\assignment\emme_assignment.py", line 277, in _copy_matrix
[EXCEPTION]     "{} {}".format(to_mtx["description"], ass_period_2.name))
[EXCEPTION] TypeError: string indices must be integers
[ERROR] [...] TypeError: string indices must be integers
[UI-event] Scenario "testi_emme-matrices" finished

My setting were following:

2023-08-17 10:21:41 [DEBUG] helmet_version=v4.1.3
2023-08-17 10:21:41 [DEBUG] sys.version_info=3
2023-08-17 10:21:41 [DEBUG] sys.path=['C:\\Users\\PiippJo\\Downloads\\helmet-model-system-refactor-emme_matrices\\Scripts', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\python37.zip', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\DLLs', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37', 'C:\\Users\\PiippJo\\AppData\\Roaming\\Python\\Python37\\site-packages', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib\\site-packages', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib\\site-packages\\win32', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib\\site-packages\\win32\\lib', 'C:\\Program Files\\INRO\\Emme\\Emme 4\\Emme-23.00.01.23\\Python37\\lib\\site-packages\\Pythonwin']
2023-08-17 10:21:41 [DEBUG] log_level=DEBUG
2023-08-17 10:21:41 [DEBUG] log_format=JSON
2023-08-17 10:21:41 [DEBUG] end_assignment_only=False
2023-08-17 10:21:41 [DEBUG] is_agent_model=False
2023-08-17 10:21:41 [DEBUG] do_not_use_emme=False
2023-08-17 10:21:41 [DEBUG] separate_emme_scenarios=False
2023-08-17 10:21:41 [DEBUG] save_matrices=True
2023-08-17 10:21:41 [DEBUG] del_strat_files=True
2023-08-17 10:21:41 [DEBUG] scenario_name=testi_emme-matrices
2023-08-17 10:21:41 [DEBUG] results_path=E:\Results\Jopi_testi
2023-08-17 10:21:41 [DEBUG] emme_path=D:\helmet_41\Projektit\pienitestiprojekti\pienitestiprojekti.emp
2023-08-17 10:21:41 [DEBUG] first_scenario_id=51
2023-08-17 10:21:41 [DEBUG] first_matrix_id=400
2023-08-17 10:21:41 [DEBUG] baseline_data_path=C:\Users\PiippJo\Downloads\helmet-model-system-olusanya\Scripts\tests\test_data\Base_input_data
2023-08-17 10:21:41 [DEBUG] forecast_data_path=C:\Users\PiippJo\Downloads\helmet-model-system-olusanya\Scripts\tests\test_data\Scenario_input_data\2030_test
2023-08-17 10:21:41 [DEBUG] iterations=15
2023-08-17 10:21:41 [DEBUG] max_gap=1.0
2023-08-17 10:21:41 [DEBUG] rel_gap=0.01
2023-08-17 10:21:41 [DEBUG] use_fixed_transit_cost=False

Thank you both for testing this thoroughly (i.e., doing the job that I should have done). ❤️

johpiip
johpiip previously approved these changes Aug 17, 2023
Copy link
Contributor

@johpiip johpiip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test run succeeded and old and new matrices have same names, descriptions, and order. Nice work! 😊 Sorry for the delay in reviewing!

@johpiip
Copy link
Contributor

johpiip commented Aug 17, 2023

Hey, sorry, I still have a question! By mistake, I ran the second model run with wrong scripts so even though everything work now, matrices are in different order and descriptions are different.

Other matrices are in same order are previously but trip_part matrices are differently. Does this clarify:

kuva

Is this preferred behaviour or should we have them in the same order?

Descriptions in this PR are more condensed than previously and do not add much new information on top of the matrix name. Did you consider having the same description info as earlier? Examples can be seen in the image above, too.

@zptro
Copy link
Collaborator Author

zptro commented Aug 18, 2023

Hey, sorry, I still have a question! By mistake, I ran the second model run with wrong scripts so even though everything work now, matrices are in different order and descriptions are different.

Other matrices are in same order are previously but trip_part matrices are differently. Does this clarify:

kuva

Is this preferred behaviour or should we have them in the same order?

Descriptions in this PR are more condensed than previously and do not add much new information on top of the matrix name. Did you consider having the same description info as earlier? Examples can be seen in the image above, too.

Good comments!

The so-called trip-part matrix dictionary now goes directly into the specification of matrix results calculation (which means they are split into total matrices and matrices by mode subset), so that is the reason why it cannot be in exactly the same order as before. But I changed the order a bit so that it is as close as possible to what it was before.

I also changed the description to a more descriptive one, which is in fact also what it is in the Modeller tool specification.

@zptro zptro requested a review from johpiip August 22, 2023 09:04
Copy link
Contributor

@hsl-petrhaj hsl-petrhaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works on my computer. Tiny (about 1 ppm) differences in the results compared to the latest olusanya, not a problem by my standards.
The demand matrix looks the same, amount of trips is the same as well. I did not check the order of the matrices.

@zptro zptro merged commit 5a14cc7 into olusanya Sep 4, 2023
2 checks passed
@zptro zptro deleted the refactor/emme_matrices branch September 4, 2023 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants